package com.appspot.dojompdft.shared;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.datanucleus.jpa.annotations.Extension;

import com.google.gwt.user.client.rpc.GwtTransient;
import com.google.gwt.user.client.rpc.IsSerializable;


@Entity
public class Evento implements Serializable, IsSerializable{

	private static final long serialVersionUID = -8514227886779158494L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true")
	private String id;

	private String descricao = null;

	private Integer limiteInscricoes = 0;

	private String data = null;

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	@OneToMany(mappedBy="evento",targetEntity=Inscricao.class,cascade=CascadeType.ALL, fetch=FetchType.EAGER)
	private Collection<Inscricao> inscricoes;
	
	public Evento() {
		
	}

	public Evento(String descricao, String data, Integer limiteInscricoes) {
		super();
		this.descricao = descricao;
		this.data = data;
		this.limiteInscricoes = limiteInscricoes;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public Integer getLimiteInscricoes() {
		return limiteInscricoes;
	}

	public void setLimiteInscricoes(Integer limiteInscricoes) {
		this.limiteInscricoes = limiteInscricoes;
	}

	public Collection<Inscricao> getInscricoes() {
		return inscricoes;
	}

	public void setInscricoes(Collection<Inscricao> inscricoes) {
		this.inscricoes = inscricoes;
	}

	
}
